﻿using System;
using System.Collections;
using System.Data;


public partial class FE_CheckOutModal : HSMPage
{
    protected int RoomID
    {
        get
        {
            return int.Parse(SecureQueryString["roomID"]);
        }
    }
    protected int InvoiceID
    {
        get
        {
            return int.Parse(SecureQueryString["InvoiceID"]);
        }
    }
   
    protected void Page_Load(object sender, EventArgs e)
    {
        this.PageType = GuruPageType.Modal;
        this.FixedModalWidth = HSMConstants.DefaultFixedModalWidth;
        if (!IsPostBack)
        {
            uxCustomerView.LoadByGuestByInvoice(this.InvoiceID);
            DataTable details = this.uxCheckOutDetails.LoadDetails();
            if (details.Rows[0]["IsCheckedOut"].IsNotNull() && bool.Parse(details.Rows[0]["IsCheckedOut"].ToString()))
            {
                this.uxCheckOut.Visible = false;
            }
            else this.uxCheckOut.Visible = true;
        }       
    }

    protected void uxCheckOut_Click(object sender, EventArgs e)
    {
        this.uxCheckOutDetails.CheckOut();
        string qString = string.Format("InvoiceID={0}&RoomID={1}", this.InvoiceID.ToString(), this.RoomID);
        this.Response.Redirect("InvoiceModal.aspx?" + BuildSecureQueryString(qString));
    }
    protected void uxSave_Click(object sender, EventArgs e)
    {
        this.uxCheckOutDetails.Save();        
    }   
}
